﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EmbeddedSharp.Core;

namespace Zove.Scripting.Guikit {

    public class MessageDialogNode : FuncNode {
        public MessageDialogNode()
            : base() {
            base.Value = "MessageDialog";
        }

        public override object Evaluate() {
            if (Parameters.Count < 1) {
                throw new Exception("usage: MessageDialog(message)");
            }

            string message = Parameters[0].Evaluate().ToString();
            if (MessageBox.Show(message) == DialogResult.OK) {
                return true;
            }

            return string.Empty;
        }
    }
}
